<template>
  <div class="card-wrap">
    <div class="header-title" v-if="title">
      <span class="header-title-icon"></span>
      {{ title }}
    </div>
    <div>
      <slot name="middle"></slot>
    </div>
    <div class="card-content">
      <slot></slot>
    </div>

    <CardDivider v-if="divider" style="margin-top: 30px" />
  </div>
</template>

<script setup lang="ts">
  import CardDivider from './card-divider.vue'
  defineProps({
    title: {
      type: String,
      default: '',
    },
    divider: {
      type: Boolean,
      default: false,
    },
  })
</script>
<style lang="less" scoped>
  .card-wrap {
    margin-top: 30px;
    margin-bottom: 30px;
    .header-title {
      font-weight: 600;
      font-size: 16px;
      color: #1d2129;
      line-height: 24px;
      padding-bottom: 24rpx;
      display: flex;
      align-items: center;
      margin-bottom: 12px;

      .title-wrap {
        display: flex;
        align-items: center;
        gap: 8rpx;
      }
      &-icon {
        width: 5px;
        height: 19px;
        background: #1890ff;
        margin-right: 8px;
      }
    }
    .card-content {
      display: flex;
      flex-wrap: wrap;
      gap: 20px;
      align-items: stretch;
    }
  }
</style>
